<template>
    <p>{{count}}</p>
    <button @click="add">+</button>
</template>
<script setup>
import {ref,watchEffect} from 'vue';
const count = ref(0);
//它会自动跟踪响应式的依赖，并且在依赖项发生变化时重新执行函数
watchEffect(()=>{
    console.log(`count is ${count.value}`)
});
const add = ()=>count.value++;
</script>